﻿namespace Compass.Wasm.Shared.Plans;
/// <summary>
/// 项目主计划
/// </summary>
public class MainPlanDto:BaseDto
{
    #region 基本属性
    //创建时间
    private DateTime createTime;
    public DateTime CreateTime { get => createTime; set { createTime = value; OnPropertyChanged(); } }

    //SQ/FSO号码
    private string number;
    public string Number { get => number; set { number = value; OnPropertyChanged(); } }
    private string name;
    public string Name { get => name; set { name = value; OnPropertyChanged(); } }

    private int quantity;
    public int Quantity { get => quantity; set { quantity = value; OnPropertyChanged(); } }

    private string? modelSummary;
    public string? ModelSummary { get => modelSummary; set { modelSummary = value; OnPropertyChanged(); } }

    public DateTime FinishTime { get; set; }

    public DateTime DrwReleaseTarget { get; set; }

    public DateTime MonthOfInvoice { get; set; }//开票月份，input type=month

    public MainPlanType_e MainPlanType { get; set; }//海工, ETO, KFC

    public string? Remarks { get; set; }

    public int Batch { get; set; }
    #endregion

    #region 记录但是不显示的属性
    public int ItemLine { get; set; }//订单行

    public double Workload { get; set; }//工作量

    public double Value { get; set; }//税后价格 

    #endregion

    #region 状态属性
    public Guid? ProjectId { get; set; }//关联项目,可以多个主计划关联到一个订单

    public MainPlanStatus_e Status { get; set; }//计划,制图,生产,入库,结束

    public DateTime? DrwReleaseTime { get; set; }

    public DateTime? WarehousingTime { get; set; }//第一台生产完工入库的时间->进入库存状态

    public DateTime? ShippingTime { get; set; }//项目第一台真实发货的时间->进入发货状态，用减去
                                               //WarehousingTime，用户计算成品库存时间
    public DateTime? ClosedTime { get; set; }//项目总结经验后结束的时间 


    #endregion

    #region 查询时赋值状态属性
    public bool IsDrwReleased { get; set; }
    public bool IsWarehoused { get; set; }
    public bool IsShipped { get; set; }
    public bool IsClosed { get; set; }
    #endregion

    #region 查询时附加属性

    public bool AllIssueClosed { get; set; } = true;//是否有未关闭的问题

    public string IssueTitles { get; set; }//异常描述

    public List<IssueDto> IssueDtos { get; set; }=new ();//项目异常列表

    public List<LessonDto> LessonDtos { get; set; }=new ();//经验教训列表

    private bool havePackingList;
    public bool HavePackingList { get=>havePackingList; set { havePackingList=value;OnPropertyChanged(); } }//是否有托盘
    #endregion

}


/// <summary>
/// 从csv导入计划
/// </summary>
public class MainPlanString
{
    public string? Batch { get; set; }//->DeliveryBatch_e
    public string? CreateTime { get; set; }//->DateTime,创建时间
    public string? Number { get; set; }//SQ/FSO号码
    public string? Name { get; set; }
    public string? Quantity { get; set; } //->int
    public string? ItemLine { get; set; }//->int,订单行
    public string? FinishTime { get; set; }//->DateTime
    public string? DrwReleaseTarget { get; set; }//->DateTime
    public string? DrwReleaseTime { get; set; }//->double
    public string? PackingDate { get; set; }//打包日期，todo：暂时作为入库日期，后续优化
    public string? ModelSummary { get; set; }
    public string? Workload { get; set; }//->double,工作量
    public string? MonthOfInvoice { get; set; }//->DateTime,开票月份，input type=month
    public string? Purchase { get; set; }
    public string? Value { get; set; }//->double,税后价格
    public string? Remark { get; set; }
}